import Vue from 'vue';
import App from './App.vue';
import store from './utils/store';
import msgAlert from "@/utils/msgAlert";
import commonAlert from "@/utils/commonAlert";
import commonFun from "./utils/common" //公共方法
import VueRouter from 'vue-router';
Vue.use(VueRouter);

import 'lib-flexible/flexible';
import './styles/reset.css';
// import './styles/global.scss';
import "./css/common.css";
import "./css/landscape.css";

// import VueTouch from 'vue-touch';
// Vue.use(VueTouch,{name:'v-touch'});

import { Icon,Toast,Navbar,Input,Container,Divider,Button,
         Actionsheet,Datetime,PopupPicker,Popup,Textarea,
         Cell,Flexbox,FlexboxItem,Modal,Tab, TabItem,Slider,
         Spinner,Swipeout, SwipeoutItem, SwipeoutButton,Card   } from 'sfmui'
Vue.component(Navbar.name, Navbar);
Vue.component(Icon.name, Icon);
Vue.component(Input.name, Input);
Vue.component(Container.name, Container );
Vue.component(Divider.name, Divider );
Vue.component(Button.name, Button );
Vue.component(Actionsheet.name, Actionsheet );
Vue.component(Datetime.name, Datetime );
Vue.component(PopupPicker.name, PopupPicker );
Vue.component(Popup.name, Popup );
Vue.component(Textarea.name, Textarea );
Vue.component(Cell.name, Cell );
Vue.component(Flexbox.name, Flexbox);
Vue.component(FlexboxItem.name, FlexboxItem);
Vue.use(Toast);
Vue.use(Modal);
Vue.component(Tab.name, Tab);
Vue.component(TabItem.name, TabItem);
Vue.component(Slider.name, Slider);
Vue.component(Spinner.name, Spinner);
Vue.component(Swipeout.name, Swipeout);
Vue.component(SwipeoutItem.name, SwipeoutItem);
Vue.component(SwipeoutButton.name, SwipeoutButton);
Vue.component(Card.name, Card);

Vue.config.productionTip = false;
import './resetXMLHttpRequest';

Vue.prototype.commonFun = commonFun;
import { http } from './utils/request';
Vue.prototype.$http = http;
Vue.prototype.$msgAlert = msgAlert;
Vue.prototype.$commonAlert = commonAlert;

// 路由信息
import routes from './router.js'
const router = new VueRouter({
	routes
});
export {router};

//初始化神策JS JDK   start
import getEnv from './getEnv';
console.log('***env***:',getEnv());
let server_url='https://ubs.sf-express.com/sa?project=sfair';
if(getEnv() != 'prd'){
    server_url='http://ubs-web.sf-express.com/sa/to-sdg-import/?project=sfairgray';
}
console.log('***server_url***:',server_url);
var sensors = require('sa-sdk-javascript');
sensors.init({
    show_log: true,
    server_url: server_url,
    is_track_single_page:true,
    use_client_time:true,
    send_type:'beacon',
    heatmap: {
        clickmap:'not_collect',
        scroll_notice_map:'not_collect'
    }
});

let userId=localStorage.userid;
let userName=localStorage.username;

//用于采集 $pageview 事件。
sensors.quick('autoTrack',{
    platform_type: 'H5',
    platform_name: 'AIR_GSS_WEB',
    system_code: 'CAIR-GSS-CORE',
    platform_env:getEnv,
    is_login: 'true',
    emp_id: userId ? userId: '',
    emp_name: userName ? userName: '',
});
Vue.prototype.$sensors=sensors; //sensors 挂在vue的原型上


new Vue({
    router,
    store,
    render: h => h(App),
}).$mount('#app');
